package com.gomyb.snow;

import java.util.HashSet;
import java.util.Set;

/**
 * @author <a href="mailto:hellohesir@gmail.com">Mr_He</a>
 * 2019/8/8 5:11
 */
public class SnowTest {

    public static void main(String[] args) throws InterruptedException {
        Set<Long> set = new HashSet<>();
        for (int i = 0; i < 2; i++) {
            int finalI = i;
            new Thread(() -> {
                SnowFlake snowFlake = new SnowFlake(1, (long) finalI);
                for (int j = 0; j < 10000; j++) {
                    long l = snowFlake.nextId();
                    set.add(l);
                    System.out.println(l);
                }
            }).start();
            System.out.println("=====================");
        }
        Thread.sleep(3000);
        System.out.println(set.size());
    }
}
